//
//  BaseModel.m
//  UI19视图切换
//
//  Created by dllo on 16/3/8.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "BaseModel.h"

@implementation BaseModel


//转化方法
+(NSMutableArray *)transformWithArray:(NSArray *)arr{
//创建空数组
    NSMutableArray *mArr=[NSMutableArray array];
//    遍历传入参数
    for (NSDictionary *dic in arr) {
//        创建对象
        id m=[[self class] modelWithDic:dic];
        [mArr addObject:m];
    }
    return mArr;
}


//遍历构造器

+(instancetype)modelWithDic:(NSDictionary *)dic{
    id  m=[[[self class] alloc]initWithDic:dic];
    return m;
}






-(instancetype)initWithDic:(NSDictionary *)dic{
    self=[super init];
    if (self) {
// kvc赋值
        [self setValuesForKeysWithDictionary:dic];
        
    }
    return self;
}



//kvc赋值容错方法
-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
    
}
@end
